
using System;
using Qdb;
using Qdb.Ext;

namespace Qdb.Internal
{
	/// <exclude></exclude>
	public class Exceptions4
	{
		public static void ThrowRuntimeException(int code)
		{
			ThrowRuntimeException(code, null, null);
		}

		public static void ThrowRuntimeException(int code, Exception cause)
		{
			ThrowRuntimeException(code, null, cause);
		}

		public static void ThrowRuntimeException(int code, string msg)
		{
			ThrowRuntimeException(code, msg, null);
		}

		public static void ThrowRuntimeException(int code, string msg, Exception cause)
		{
			ThrowRuntimeException(code, msg, cause, true);
		}

		[System.ObsoleteAttribute]
		public static void ThrowRuntimeException(int code, string msg, Exception cause, bool
			 doLog)
		{
			if (doLog)
			{
				Qdb.Internal.Messages.LogErr(QdbFactory.Configure(), code, msg, cause
					);
			}
			throw new QdbException(Qdb.Internal.Messages.Get(code, msg));
		}

		[System.ObsoleteAttribute(@"Use com.qdb.foundation.NotSupportedException instead"
			)]
		public static void NotSupported()
		{
			ThrowRuntimeException(53);
		}

		/// <exception cref="Qdb.Ext.QdbException"></exception>
		public static void CatchAllExceptQdbException(Exception exc)
		{
			if (exc is QdbException)
			{
				throw (QdbException)exc;
			}
		}

		public static Exception ShouldNeverBeCalled()
		{
			throw new Exception();
		}

		public static void ShouldNeverHappen()
		{
			throw new Exception();
		}

		public static Exception VirtualException()
		{
			throw new Exception();
		}
	}
}
